/*
 * @Author: C.
 * @Date: 2024-07-30 21:51:15
 */
export function getElSize(el: Element) {
  const style = window.getComputedStyle(el);
  const rect = el.getBoundingClientRect();
  return {
    width: parseFloat(style.getPropertyValue("width")),
    height: parseFloat(style.getPropertyValue("height")),
    x: rect.left,
    y: rect.top
  };
}
// 0 - Boundary
export function moveBoundary(
  parent = false,
  value: number,
  boundary: number,
  self: number
) {
  if (!parent) return value;
  if (value < 0) {
    return 0;
  } else if (value >= boundary - self) {
    return boundary - self;
  }
  return value;
}
